//
//  AccountDetailPageView.m
//  ELife
//
//  Created by  刘奇男 on 11-5-17.
//  Copyright 2011年 __MyCompanyName__. All rights reserved.
//

#import "AccountDetailPageViewController.h"
#import "Constants.h"

@implementation AccountDetailPageViewController

@synthesize textFields, keys;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)dealloc
{
    [super dealloc];
    [textFields release];
    [keys release];
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
}
*/


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
    
    keys = [[NSArray alloc] initWithObjects:@"交易时间",@"交易类型",@"收入",@"支出",@"冻结",@"方案号", nil];
    
    textFields =  [NSMutableArray array];

    int lineHeight = 25;
    int y = 20;
    for (NSString *key in keys)
	{
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(10, y, 80, 20)];
        [label setBackgroundColor:[UIColor clearColor]];
        [label setTextColor:[UIColor whiteColor]];
        [label setText:key];
        [label setFont:[UIFont systemFontOfSize:[UIFont labelFontSize]]];
        [self.view addSubview:label];
        [label release];
        
        
        UITextField* textField = [[UITextField alloc] initWithFrame:CGRectMake(110, y, 180, 20)];
        [textField setUserInteractionEnabled:NO];
        [textField setText:@"10"];
        [textField setTextColor:[UIColor darkGrayColor]];
        [textField setTextAlignment:UITextAlignmentCenter];
        [textField setBackgroundColor:[UIColor grayColor]];
        
        NSMutableDictionary* dic = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                    key, kTitleKey, 
                                    textField, kDetailKey,                                    nil];
        [textFields addObject:dic];
        [self.view addSubview:textField];
        [textField release];
        
        y += lineHeight;
    }
}


- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
